﻿using UnityEngine;
using UnityEngine.UI;

public static class ImageExtensions
{
    #region Image-Alpha

    public static void ChangeAlpha(this Image image, float alpha)
    {
        var oldColor = image.color;
        image.color = new Color(oldColor.r, oldColor.g, oldColor.b, alpha);
    }

    #endregion

    #region RawImage-Alpha

    public static void ChangeAlphaRaw(this RawImage image, float alpha)
    {
        var oldColor = image.color;
        image.color = new Color(oldColor.r, oldColor.g, alpha);
    }

    #endregion
}